<?php

use Lg\View\JsBlock;
use Lg\View\Asset;
?>
<?php echo get_header(); ?>
<form class="form-horizontal" action="" method="post">
    <div class="padding-md">

        <div class="row">
            <div class="col-md-12">
                <div class="panel panel-default">                    
                    <div class="panel-tab clearfix">
                        <ul class="tab-bar">
                            <li class="active"><a href="#settings" data-toggle="tab">基本信息</a></li>
                            <li ><a href="#general" data-toggle="tab">常规设置</a></li>
                        </ul>
                    </div>
                    <div class="panel-body">
                        <div class="tab-content">
                            <div class="tab-pane active" id="settings">

                                <div class="padding-sm">


                                    <ul class="nav nav-tabs">              
                                        <!--class="active"-->
                                        <?php foreach ($languages as $language) { ?>
                                            <li <?php
                                            if (get_option('system.admin_language', 'zh_CN') == $language->directory) {
                                                echo 'class="active"';
                                            }
                                            ?> >
                                                <a href="#language<?php echo $language->language_id; ?>" data-toggle="tab" aria-expanded="true">
                                                    <span class="flag flag-<?php echo $language->code;?>" ></span> <?php echo $language->name; ?></a></li>                        
                                        <?php } ?>

                                    </ul>
                                    <div class="tab-content">
                                        <?php
                                        foreach ($languages as $language) {
                                            $lang_id = $language->language_id;
                                            ?>
                                            <div class="tab-pane active" id="language<?php echo $language->language_id; ?>">
                                                <div class="padding-sm">
                                                    <div class="form-group required">
                                                        <label class="col-sm-2 control-label" for="title<?php echo $language->language_id; ?>">分类标题</label>
                                                        <div class="col-sm-10">
                                                            <input type="text" name="language[<?php echo $language->language_id; ?>][title]" value="<?php echo $category_languages[$lang_id]->title; ?>" placeholder="分类名称" id="title<?php echo $language->language_id; ?>" class="form-control">
                                                        </div>
                                                    </div>
                                                    <div class="form-group required">
                                                        <label class="col-sm-2 control-label" for="description<?php echo $language->language_id; ?>">分类描述</label>
                                                        <div class="col-sm-10">
                                                            <textarea rows="7"  name="language[<?php echo $language->language_id; ?>][description]" placeholder="描述" id="description<?php echo $language->language_id; ?>" class="form-control"><?php echo $category_languages[$lang_id]->description; ?></textarea>
                                                        </div>
                                                    </div>
                                                    <div class="form-group required">
                                                        <label class="col-sm-2 control-label" for="meta_keywords<?php echo $language->language_id; ?>">关键词</label>
                                                        <div class="col-sm-10">
                                                            <input type="text" name="language[<?php echo $language->language_id; ?>][meta_keywords]" value="<?php echo $category_languages[$lang_id]->meta_keywords; ?>" placeholder="Meta tag 关键词" id="description<?php echo $language->language_id; ?>" class="form-control">
                                                        </div>
                                                    </div>
                                                    <div class="form-group required">
                                                        <label class="col-sm-2 control-label" for="meta_description<?php echo $language->language_id; ?>">关键词描述</label>
                                                        <div class="col-sm-10">
                                                            <input type="text" name="language[<?php echo $language->language_id; ?>][meta_description]" value="<?php echo $category_languages[$lang_id]->meta_description; ?>" placeholder="Meta tag 关键词描述" id="description<?php echo $language->language_id; ?>" class="form-control">
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        <?php } ?>
                                    </div>




                                </div>
                                <!-- /.box-body -->
                                <div class="box-footer">
                                    <button type="submit" class="btn btn-success pull-right">保存设置</button>
                                </div>
                                <!-- /.box-footer -->


                            </div>
                            <!-- /.tab-pane -->   
                            <div class="tab-pane" id="general">
                                <div class="form-group required">
                                    <label class="col-sm-2 control-label" for="parent_id">上级分类</label>
                                    <div class="col-sm-10">
                                        <select name="category[parent_id]" class="form-control">
                                            <option value="0">-- 请选择分类 --</option>
                                            <?php foreach ($categories as $cat) { ?>
                                                <option <?php echo $cat->category_id == $category->parent_id ? ' selected ' : NULL; ?> value="<?php echo $cat->category_id; ?>"><?php
                                                    echo str_repeat('&nbsp;', ($cat->depth - 1) * 4), $cat->title;
                                                    ?></option>
                                            <?php } ?>

                                        </select>
                                    </div>
                                </div>
                                <div class="form-group required">
                                    <label class="col-sm-2 control-label" for="parent_id">状态</label>
                                    <div class="col-sm-10">
                                        <select name="category[status]" class="form-control">
                                            <option value="1">启用</option>
                                            <option value="0">禁用</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="box-footer">
                                    <button type="submit" class="btn btn-success pull-right">保存设置</button>
                                </div>
                                <!-- /.box-footer -->
                            </div>

                        </div>
                        <!-- /.tab-content -->
                    </div>
                </div>




            </div>
            <!-- /.col -->
        </div>
        <!-- /.row -->

    </div>
</form>
<?php
JsBlock::begin(Asset::BODY_END);
?>
<script type="text/javascript">
    $(function () {

    });
</script>
<?php JsBlock::end(); ?>
<?php echo get_footer(); ?>